<%@page import="merlin.beans.*,merlin.dao.*,merlin.managers.*,merlin.servlets.*,merlin.utils.*" isErrorPage="true"%>

<HTML>
<head>
	<title>Error</title>
	<meta HTTP-EQUIV="Cache-Control"  CONTENT="no-cache" />
	<meta HTTP-EQUIV="Expires"        CONTENT="1 Jan 1980" />
	<meta HTTP-EQUIV="MaxAge"         CONTENT="0" />
	<meta HTTP-EQUIV="Pragma-Control" CONTENT="no-cache" />
</head>
<BODY>
<%
	// Determine the root cause.
	Throwable rootException = exception;
	while(exception != null){
		rootException = exception;
  		exception = exception.getCause();
	}

	//dump the root cause on the standard output.
 	System.out.println("~~~~~~~~~~~~~~>");
 	System.out.println(rootException);
 	System.out.println("<~~~~~~~~~~~~~~");

	// get the root cause message

	String reason = rootException.getMessage();

	if(reason == null){
		reason = "Some error has occured";
	}else{
		// escape the " and ' characters , if any present as Javascript has a problem displaying such strings.
		reason = reason.replaceAll("\"","&quot;");
		reason = reason.replaceAll("\'","&#39;");

	}
	System.out.println("Error message to display " + reason);
%>

	<script>
		var reason = "<%=reason%>";

		//if(parent.frameMessage)parent.frameMessage.displayError(reason);
		if(parent.frameMain)parent.frameMain.disableEnable(false);
		if(parent.frameMain)parent.frameMain.displayError(reason);
	</script>
	<div align="center">
		<img src="mr_images/headerMain.gif" align="center"/>
	</div>
	<div align='center' STYLE='FONT: 15px arial, verdana, sans-serif;color:red;font-weight:bold'>
	<%= reason %>
	</div>
	<form action="merlin" name="frmSearch" method="post">
		<input type="hidden" name="mode">
		<input type="hidden" name="hidSearch">
		<input type="hidden" name="hidCompanies">
		<input type="hidden" name="hidSearchType">
	</form>
</BODY>
</HTML>